import jsonp from "jsonp";

export function reqWeather(city){
    const url =`https://v1.yiketianqi.com/api?unescape=1&version=v63&appid=18745619&appsecret=9HJPRAOY`

    return new Promise((res,rej)=>{
        jsonp(url,{
            param:'callback'
        },(err,response)=>{
            if(!err && response.cityid){
                const {wea,wea_img,tem1,tem2} =response
                res({wea,wea_img,tem1,tem2})
            }else{
                console.log("获取天气失败")
            }
        })
    })

}